﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NetworkPower.Common
{
    public class MatchingRule
    {
        public static List<MRule> Rules;
        public static Dictionary<EquipmentType, string> EquipmentTypeNumberRules;
        public static void LoadMatchingRule()
        {
            Rules = new MRule().GetAllRules();
            EquipmentTypeNumberRules = Utilities.GetEquipmentTypeNumberRule();
        }
    }

    public class MRule
    {
        public Guid RuleTypeId { get; set; }
        public CableType CableType { get; set; }
        public VAType VAType { get; set; }
        public List<string> ContentType { get; set; }



        public List<MRule> GetAllRules()
        {
            var ruleList = new List<MRule>();

            #region 电压
            var rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A601,B601,C601,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A602,B602,C602,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A’601,B’601,C’601,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A’602,B’602,C’602,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A601J,B601J,C601J,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A602J,B602J,C602J,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A611,B611,C611,N611,L611".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A612,B612,C612,N612,L612".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A613,B613,C613,N613,L613".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A614,B614,C614,N614,L614".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A615,B615,C615,N615,L615".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A616,B616,C616,N616,L616".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A617,B617,C617,N617,L617".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A618,B618,C618,N618,L618".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A619,B619,C619,N619,L619".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A621,B621,C621,N621,L621".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A622,B622,C622,N622,L622".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A623,B623,C623,N623,L623".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A624,B624,C624,N624,L624".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A625,B625,C625,N625,L625".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A626,B626,C626,N626,L626".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A627,B627,C627,N627,L627".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A628,B628,C628,N628,L628".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A629,B629,C629,N629,L629".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A631,B631,C631,N631,L631".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A632,B632,C632,N632,L632".Split(',').ToList() }; ruleList.Add(rule1);

            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A633,B633,C633,N633,L633".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A634,B634,C634,N634,L634".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A635,B635,C635,N635,L635".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A636,B636,C636,N636,L636".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A637,B637,C637,N637,L637".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A638,B638,C638,N638,L638".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A639,B639,C639,N639,L639".Split(',').ToList() }; ruleList.Add(rule1);

            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A603,B603,C603,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A603',B603',C603',N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A603\",B603\",C603\",N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A603C,B603C,C603C,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A603J,B603J,C603J,N600".Split(',').ToList() }; ruleList.Add(rule1);

            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A603II,B603II,C603II,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A603II',B603II',C603II',N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A603II\",B603II\",C603II\",N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A603IIC,B603IIC,C603IIC,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A603IIJ,B603IIJ,C603IIJ,N600".Split(',').ToList() }; ruleList.Add(rule1);

            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A630II,B630II,C630II,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A630II',B630II',C630II',N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A630II\",B630II\",C630II\",N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A630IIC,B630IIC,C630IIC,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A630IIJ,B630IIJ,C630IIJ,N600".Split(',').ToList() }; ruleList.Add(rule1);

            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A604,B604,C604,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A604',B604',C604',N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A604\",B604\",C604\",N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A604C,B604C,C604C,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A604J,B604J,C604J,N600".Split(',').ToList() }; ruleList.Add(rule1);

            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A604II,B604II,C604II,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A604II',B604II',C604II',N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A604II\",B604II\",C604II\",N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A604IIC,B604IIC,C604IIC,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A604IIJ,B604IIJ,C604IIJ,N600".Split(',').ToList() }; ruleList.Add(rule1);

            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A640II,B640II,C640II,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A640II',B640II',C640II',N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A640II\",B640II\",C640II\",N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A640IIC,B640IIC,C640IIC,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A640IIJ,B640IIJ,C640IIJ,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A710,B710,C710,N600".Split(',').ToList() }; ruleList.Add(rule1);
            rule1 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电压, ContentType = "A421',B421',C421',N421'".Split(',').ToList() }; ruleList.Add(rule1);
            #endregion

            #region 电流
            var rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4011,B4011,C4011,N4011".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4021,B4021,C4021,N4021".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4031,B4031,C4031,N4031".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4041,B4041,C4041,N4041".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4051,B4051,C4051,N4051".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4061,B4061,C4061,N4061".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4071,B4071,C4071,N4071".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4081,B4081,C4081,N4081;".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4091,B4091,C4091,N4091".Split(',').ToList() }; ruleList.Add(rule2);

            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4012,B4012,C4012,N4012".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4022,B4022,C4022,N4022".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4032,B4032,C4032,N4032".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4042,B4042,C4042,N4042".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4052,B4052,C4052,N4052".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4062,B4062,C4062,N4062".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4072,B4072,C4072,N4072".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4082,B4082,C4082,N4082".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4092,B4092,C4092,N4092".Split(',').ToList() }; ruleList.Add(rule2);

            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4013,B4013,C4013,N4013".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4023,B4023,C4023,N4023".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4033,B4033,C4033,N4033".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4043,B4043,C4043,N4043".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4053,B4053,C4053,N4053".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4063,B4063,C4063,N4063".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4073,B4073,C4073,N4073".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4083,B4083,C4083,N4083".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A4093,B4093,C4093,N4093".Split(',').ToList() }; ruleList.Add(rule2);

            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4011,B’4011,C’4011,N’4011".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4021,B’4021,C’4021,N’4021".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4031,B’4031,C’4031,N’4031".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4041,B’4041,C’4041,N’4041".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4051,B’4051,C’4051,N’4051".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4061,B’4061,C’4061,N’4061".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4071,B’4071,C’4071,N’4071".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4081,B’4081,C’4081,N’4081".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4091,B’4091,C’4091,N’4091".Split(',').ToList() }; ruleList.Add(rule2);

            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4012,B’4012,C’4012,N’4012".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4022,B’4022,C’4022,N’4022".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4032,B’4032,C’4032,N’4032".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4042,B’4042,C’4042,N’4042".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4052,B’4052,C’4052,N’4052".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4062,B’4062,C’4062,N’4062".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4072,B’4072,C’4072,N’4072".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4082,B’4082,C’4082,N’4082".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4092,B’4092,C’4092,N’4092".Split(',').ToList() }; ruleList.Add(rule2);

            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4013,B’4013,C’4013,N’4013".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4023,B’4023,C’4023,N’4023".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4033,B’4033,C’4033,N’4033".Split(',').ToList() }; ruleList.Add(rule2); rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A601,B601,C601,N600".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4043,B’4043,C’4043,N’4043".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4053,B’4053,C’4053,N’4053".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4063,B’4063,C’4063,N’4063".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4073,B’4073,C’4073,N’4073".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4083,B’4083,C’4083,N’4083".Split(',').ToList() }; ruleList.Add(rule2); rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A601,B601,C601,N600".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A’4093,B’4093,C’4093,N’4093".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "LL411,LN411".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "LL411,LN411".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "LL431,LN431".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "LL441,LN441".Split(',').ToList() }; ruleList.Add(rule2); rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A601,B601,C601,N600".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "L4001,N4001".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "L4011,N4011".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "L4021,N4021".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "L4031,N4031".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "L4041,N4041".Split(',').ToList() }; ruleList.Add(rule2); rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A601,B601,C601,N600".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "L4051,N4051".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "L4061,N4061".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "L4071,N4071".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "L4081,N4081".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "L4091,N4091".Split(',').ToList() }; ruleList.Add(rule2); rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A601,B601,C601,N600".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A360,B360,C360,N360".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A330,B330,C330,N330".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A310,B310,C310,N310".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A320,B320,C320,N320".Split(',').ToList() }; ruleList.Add(rule2);
            rule2 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.电流, ContentType = "A350,B350,C350,N350".Split(',').ToList() }; ruleList.Add(rule2);

            #endregion

            #region 信号
            var rule3 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.信号, ContentType = "701,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999,9100,9101,9102,9103,9104,9105,9106,9107,9108,9109".Split(',').ToList() }; ruleList.Add(rule3);
            rule3 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.信号, ContentType = "701’,901’,902’,903’,904’,905’,906’,907’,908’,909’,910’,911’,912’,913’,914’,915’,916’,917’,918’,919’,920’,921’,922’,923’,924’,925’,926’,927’,928’,929’,930’,931’,932’,933’,934’,935’,936’,937’,938’,939’,940’,941’,942’,943’,944’,945’,946’,947’,948’,949’,950’,951’,952’,953’,954’,955’,956’,957’,958’,959’,960’,961’,962’,963’,964’,965’,966’,967’,968’,969’,970’,971’,972’,973’,974’,975’,976’,977’,978’,979’,980’,981’,982’,983’,984’,985’,986’,987’,988’,989’,990’,991’,992’,993’,994’,995’,996’,997’,998’,999’,9100’,9101’,9102’,9103’,9104’,9105’,9106’,9107’,9108’,9109’".Split(',').ToList() }; ruleList.Add(rule3);
            rule3 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.信号, ContentType = "KWa,KWb,KWc.KW0,KW1,KW2,KW3,KW4,KW5,KW6,KW7,KW8,KW9".Split(',').ToList() }; ruleList.Add(rule3);
            rule3 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.信号, ContentType = "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20".Split(',').ToList() }; ruleList.Add(rule3);
            rule3 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.信号, ContentType = "501,502,503,503A,503B,503C,504,505,506,507,508,509,510,511".Split(',').ToList() }; ruleList.Add(rule3);
            #endregion

            #region 跳闸信号
            var rule4 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.跳闸信号, ContentType = "101,R133,Q133,103,133,102,33A1,33B1,33C1,137A,137B,137C,105A,105B,105C,107A,107B,107C".Split(',').ToList() }; ruleList.Add(rule4);
            rule4 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.跳闸信号, ContentType = "201,R233,Q233,203,233,202,33A2,33B2,33C2,237A,237B,237C,205A,205B,205C,207A,207B,207C".Split(',').ToList() }; ruleList.Add(rule4);
            rule4 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.跳闸信号, ContentType = "041,045A,045B,045C,019A,019B,019C".Split(',').ToList() }; ruleList.Add(rule4);
            rule4 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.跳闸信号, ContentType = "051,055A,055B,055C".Split(',').ToList() }; ruleList.Add(rule4);
            rule4 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.跳闸信号, ContentType = "101’,R133’,Q133’,103’,133’,102’,33A1’,33B1’,33C1’,137A’,137B’,137C’,105A’,105B’,105C’,107A’,107B’,107C’".Split(',').ToList() }; ruleList.Add(rule4);
            rule4 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.跳闸信号, ContentType = "201’,R233’,Q233’,203’,233’,202’,33A2’,33B2’,33C2’,237A’,237B’,237C’,205A’,205B’,205C’,207A’,207B’,207C’".Split(',').ToList() }; ruleList.Add(rule4);
            rule4 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.跳闸信号, ContentType = "041’,045A’,045B’,045C’,019A’,019B’,019C’".Split(',').ToList() }; ruleList.Add(rule4);
            rule4 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.跳闸信号, ContentType = "051’,055A’,055B’,055C’".Split(',').ToList() }; ruleList.Add(rule4);
            rule4 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.跳闸信号, ContentType = "101”,R133”,Q133”,103”,133”,102”,33A1”,33B1”,33C1”,137A”,137B”,137C”,105A”,105B”,105C”,107A”,107B”,107C".Split(',').ToList() }; ruleList.Add(rule4);
            rule4 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.跳闸信号, ContentType = "201”,R233”,Q233”,203”,233”,202”,33A2”,33B2”,33C2”,237A”,237B”,237C”,205A”,205B”,205C”,207A”,207B”,207C".Split(',').ToList() }; ruleList.Add(rule4);
            rule4 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.跳闸信号, ContentType = "041”,045A”,045B”,045C”,019A”,019B”,019C".Split(',').ToList() }; ruleList.Add(rule4);
            rule4 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.跳闸信号, ContentType = "051\",055A\",055B\",055C\"".Split(',').ToList() }; ruleList.Add(rule4);
            rule4 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.控制电缆, VAType = VAType.跳闸信号, ContentType = "001,013,014".Split(',').ToList() }; ruleList.Add(rule4);
            #endregion

            #region 电力电缆
            var rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "KM+,KM-".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "+KM1,-KM1".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "KM1+,KM1-".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "KM2+,KM2-".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "KM3+,KM3-".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "KM4+,KM4-".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "BM+,BM-".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "BM1+,BM1-".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "BM2+,BM2-".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "BM3+,BM3-".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "BM4+,BM4-".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "~A,~B,~C,~N".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "~A1,~B1,~C1,~N".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "~A2,~B2,~C2,~N".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "~A3,~B3,~C3,~N".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "~A4,~B4,~C4,~N".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "~L,~N".Split(',').ToList() }; ruleList.Add(rule5);
            rule5 = new MRule { RuleTypeId = Guid.NewGuid(), CableType = CableType.电力电缆, VAType = VAType.无, ContentType = "~L1,~N".Split(',').ToList() }; ruleList.Add(rule5);
            #endregion

            ruleList.Add(rule1);
            return ruleList;
        }
    }
    public class Utilities
    {
        public static string 控制电缆型号前缀 = "KVVP2-22-500-";
        public static string 电力电缆型号前缀 = "VV22-0.6/1-";
        public static List<MRule> Rules;
        private static int[] CoreNumberArray = new int[6] { 2, 4, 7, 10, 14, 19 };
        private static void SetUp()
        {
            if (Rules == null)
            {
                Rules = new MRule().GetAllRules();
            }
        }
        public Utilities()
        {
            Rules = new MRule().GetAllRules();
        }
        public static MRule GetMRule(string loopNo)
        {
            SetUp();
            if (string.IsNullOrWhiteSpace(loopNo))
                return null;
            else
            {
                var result = Rules.Where(w => w.ContentType.Any(a => a.Contains(loopNo))).FirstOrDefault();
                return result;
            }
        }

        public static string GetCableType(string loopNo, int CoreNumber)
        {
            string result = string.Empty;
            CableType CableType = GetMRule(loopNo).CableType;
            if (CableType == CableType.控制电缆)
            {
                VAType vaType = GetMRule(loopNo).VAType;
                result = 控制电缆型号前缀 + string.Format("{0}×{1}", Utilities.GetNumberOfCores(CoreNumber), GetControlCableCrossSection(vaType));
            }
            else
            {
                List<string> ContentType = GetMRule(loopNo).ContentType;
                result = 电力电缆型号前缀 + GetPowerCableCrossSection(ContentType.Count); ;
            }
            return result;
        }

        public static string GetPowerCableCrossSection(int CableCoreNumber)
        {
            string result = string.Empty;
            switch (CableCoreNumber)
            {
                case 2:
                    result = "/1-2×4";
                    break;
                case 4:
                    result = "/1-3×4+1×2.5";
                    break;
                default:
                    result = "/1-2×4";
                    break;
            }
            return result;
        }

        public static string GetControlCableCrossSection(VAType vaType)
        {
            switch (vaType)
            {
                case VAType.电流:
                    return "4";
                case VAType.电压:
                    return "6";
                case VAType.信号:
                case VAType.跳闸信号:
                    return "2.5";
                default:
                    return "2.5";
            }
        }

        public static int GetNumberOfCores(int coreNum)
        {
            if (CoreNumberArray.Contains(coreNum))
            {
                return coreNum;
            }
            else
            {
                for (int i = 0; i < CoreNumberArray.Length; i++)
                {
                    if (CoreNumberArray[i] < coreNum && CoreNumberArray[i + 1] > coreNum)
                        return CoreNumberArray[i + 1];
                    else if (coreNum < CoreNumberArray[0])
                        return CoreNumberArray[0];
                    else if (coreNum < CoreNumberArray[CoreNumberArray.Length])
                        return CoreNumberArray[CoreNumberArray.Length];
                }
                return 0;
            }
        }

        public static Dictionary<EquipmentType, string> GetEquipmentTypeNumberRule()
        {
            Dictionary<EquipmentType, string> EquipmentTypeNumberMapping = new Dictionary<EquipmentType, string>();

            EquipmentTypeNumberMapping.Add(EquipmentType.from101To119, "电压互感器端子箱||PT端子箱||TV端子箱");

            EquipmentTypeNumberMapping.Add(EquipmentType.from120To129, "电流互感器端子箱||CT端子箱||断路器端子箱||智能汇控柜");
            EquipmentTypeNumberMapping.Add(EquipmentType.from185ATo185Z, "断路器机构箱");
            EquipmentTypeNumberMapping.Add(EquipmentType.from186ATo186Z, "1G隔离开关机构箱");
            EquipmentTypeNumberMapping.Add(EquipmentType.from187ATo187Z, "2G隔离开关机构箱");
            EquipmentTypeNumberMapping.Add(EquipmentType.from188ATo188Z, "3G隔离开关机构箱");
            EquipmentTypeNumberMapping.Add(EquipmentType.from189ATo189Z, "4G隔离开关机构箱");
            EquipmentTypeNumberMapping.Add(EquipmentType.from196ATo196Z, "1GD接地开关机构箱");
            EquipmentTypeNumberMapping.Add(EquipmentType.from197ATo197Z, "2GD接地开关机构箱");
            EquipmentTypeNumberMapping.Add(EquipmentType.from198ATo198Z, "3GD接地开关机构箱");
            EquipmentTypeNumberMapping.Add(EquipmentType.from199ATo199Z, "4GD接地开关机构箱");
            EquipmentTypeNumberMapping.Add(EquipmentType.from130To170, "保护||测控||保护测控||保护柜1||保护测控柜1||保护柜一||保护测控柜一||断路器保护柜||间隔测控柜||断路器测控柜||远跳保护柜||远跳测控柜||线路测控柜||线路保护柜");
            EquipmentTypeNumberMapping.Add(EquipmentType.from230To270, "保护柜2||保护测控柜2||保护柜二||保护测控二");
            EquipmentTypeNumberMapping.Add(EquipmentType.ZL130190, "馈电屏 || 分配屏");
            EquipmentTypeNumberMapping.Add(EquipmentType.ZLX130190, "馈电屏 || 分配屏");
            EquipmentTypeNumberMapping.Add(EquipmentType.XDC130190, "蓄电池");
            EquipmentTypeNumberMapping.Add(EquipmentType.GY330130190, "公用柜");
            EquipmentTypeNumberMapping.Add(EquipmentType.GY750130190, "公用柜");
            EquipmentTypeNumberMapping.Add(EquipmentType.GL330130190, "故障录波");
            return EquipmentTypeNumberMapping;
        }

        public static bool IsVolatage(string cricleNo)
        {
            bool flag = false;
            if (MatchingRule.Rules.Count() > 0)
            {
                var result = MatchingRule.Rules.Where(r => r.ContentType.Contains(cricleNo)).FirstOrDefault();
                if (result != null && result.VAType == VAType.电压)
                {
                    flag = true;
                }
            }
            return flag;
        }

        public static bool Is330Voltage(string cricleNo)
        {
            bool is330V = true;
            if (IsVolatage(cricleNo) && is330V)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public static bool IsMatchedFor馈电屏Or分配屏(string cricleNo)
        {
            List<MRule> For馈电屏Or分配屏 = new List<MRule>();
            if (MatchingRule.Rules.Count() > 0)
            {
                //这些条件是 “馈电屏或分配屏” 之外的条件，首先将其作为前提，如果某一挑匹配项的回路编号是其中的一个，那么就返回true，否则返回false，这里只用一个条件几个，比如KM+和KM-需要一个就可以了，因为他们是一组，所以都可以取出规则里的一条出来
                For馈电屏Or分配屏.Add(MatchingRule.Rules.Where(r => r.ContentType.Contains("KM+")).FirstOrDefault());
                For馈电屏Or分配屏.Add(MatchingRule.Rules.Where(r => r.ContentType.Contains("KM1+")).FirstOrDefault());
                For馈电屏Or分配屏.Add(MatchingRule.Rules.Where(r => r.ContentType.Contains("KM2+")).FirstOrDefault());
                For馈电屏Or分配屏.Add(MatchingRule.Rules.Where(r => r.ContentType.Contains("KM3+")).FirstOrDefault());
                For馈电屏Or分配屏.Add(MatchingRule.Rules.Where(r => r.ContentType.Contains("KM4+")).FirstOrDefault());
                For馈电屏Or分配屏.Add(MatchingRule.Rules.Where(r => r.ContentType.Contains("BM+")).FirstOrDefault());
                For馈电屏Or分配屏.Add(MatchingRule.Rules.Where(r => r.ContentType.Contains("BM1+")).FirstOrDefault());
                For馈电屏Or分配屏.Add(MatchingRule.Rules.Where(r => r.ContentType.Contains("BM2+")).FirstOrDefault());
                For馈电屏Or分配屏.Add(MatchingRule.Rules.Where(r => r.ContentType.Contains("BM3+")).FirstOrDefault());
                For馈电屏Or分配屏.Add(MatchingRule.Rules.Where(r => r.ContentType.Contains("BM4+")).FirstOrDefault());
            }

            if (For馈电屏Or分配屏.Where(r => r.ContentType.Contains(cricleNo)).Count() > 0) //因为在规则中，回路编号使用list的形式分开存放的，所以可以用Contain方法来判断
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public static string GetMixNumberByEquipmentType(string equipmentName, string cricleNo)
        {
            if (MatchingRule.EquipmentTypeNumberRules.Count() > 0)
            {
                var rules = MatchingRule.EquipmentTypeNumberRules.Where(e => e.Value.IndexOf(equipmentName) >= 0);
                if (rules == null)
                {
                    return string.Empty;
                }

                if (rules.Count() > 1) //
                {
                    if (rules.Where(r => r.Key == EquipmentType.ZL130190) != null
                        && rules.Where(r => r.Key == EquipmentType.ZL130190).Count() > 0) // 那么是馈电屏
                    {
                        if (IsMatchedFor馈电屏Or分配屏(cricleNo))
                        {
                            return "ZL-130";
                        }
                        else
                        {
                            return "ZLX-130";
                        }
                    }
                    else if (rules.Where(r => r.Key == EquipmentType.GY750130190) != null
                        && rules.Where(r => r.Key == EquipmentType.GY750130190).Count() > 0)// 那么是公用柜
                    {
                        if (Is330Voltage(cricleNo))
                        {
                            return "GY330-130";
                        }
                        else if (IsVolatage(cricleNo))
                        {
                            return "GY750-130";
                        }
                    }
                }
                else if (rules.Count() == 1) //
                {
                    if (rules.Where(r => r.Key == EquipmentType.GL330130190) != null &&
                        rules.Where(r => r.Key == EquipmentType.ZL130190).Count() > 0) //是故障录波
                    {
                        if (IsVolatage(cricleNo))
                        {
                            return "GL330-130";
                        }
                    }
                    else
                    {
                        string result = string.Empty;
                        var equipmentType = rules.FirstOrDefault();
                        switch (equipmentType.Key)
                        {
                            case EquipmentType.from101To119:
                                result = "101";
                                break;
                            case EquipmentType.from120To129:
                                result = "120";
                                break;
                            case EquipmentType.from185ATo185Z:
                                result = "185A";
                                break;
                            case EquipmentType.from186ATo186Z:
                                result = "186A";
                                break;
                            case EquipmentType.from187ATo187Z:
                                result = "187A";
                                break;
                            case EquipmentType.from188ATo188Z:
                                result = "188A";
                                break;
                            case EquipmentType.from189ATo189Z:
                                result = "189A";
                                break;
                            case EquipmentType.from196ATo196Z:
                                result = "196A";
                                break;
                            case EquipmentType.from197ATo197Z:
                                result = "197A";
                                break;
                            case EquipmentType.from198ATo198Z:
                                result = "198A";
                                break;
                            case EquipmentType.from199ATo199Z:
                                result = "199A";
                                break;
                            case EquipmentType.from130To170:
                                result = "130";
                                break;
                            case EquipmentType.from230To270:
                                result = "230";
                                break;
                            case EquipmentType.XDC130190:
                                result = "XDC-130";
                                break;
                        }
                        return result;
                    }
                }
            }
            return string.Empty;
        }
    }
}
